const async = require('async');
const services = require('../../services');

const commonService = services.common;
const eLancoService = services.eLanco;

module.exports = (req, res, callback) => {
  const params = req.query;
  const { SysDictionary: dictionaryModel, SysDepartment: departmentModel, WfForm: formModel } = commonService.getModels();
  async.parallel({
    formList: async.apply(commonService.getList, formModel),
    dictionaryList: async.apply(commonService.getList, dictionaryModel),
    departmentList: async.apply(commonService.getList, departmentModel),
    approvalList: async.apply(eLancoService.getApprovalList, params),
    pageTotal: async.apply(eLancoService.getApprovalListPageTotal, params),
  }, callback);
};
